﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Auto_Buy.Component
{
    public class ProductBuyRecord
    {
        public static async Task<List<BuySubRecord>> BuyRecord(long productId, int pageIndex = 1, int pageSize = 10)
        {
            var body = new RequestBody();
            body.Method = "BuyRecord";
            var d = JsonConvert.SerializeObject(new { ProductId = productId , pageIndex, pageSize });
            body.Data = d;
            var respone = await HttpUnit.Post(body);
            if (respone.IsSuccessStatusCode)
            {
                return ResponseBody.GetGridData<BuySubRecord>(await respone.Content.ReadAsStringAsync());
            }
            return null;
        }
    }
}
